class FavoriteWork < ActiveRecord::Base
  
  belongs_to :user
  belongs_to :work
  
  def self.delete_favorite(user,ids)
    if ids
      transaction do
        ids.each do|id|
         destroy(find_by_user_id_and_work_id(user.id,id))
        end
      end
    end
  end
end
